<!--
 * @Description: 数据字典类型表单
 * @Autor: Zhu_liangyu
 * @Date: 2020-05-09 10:52:56
--> 
<template>
  <basic-form
    ref="dictionaryTypeForm"
    v-model="dictionaryTypeForm"
    :rules="dictionaryTypeRule"
    primary-key="dictionaryTypeId"
    :query-api="dictionaryType_queryByIdApi"
    :insert-api="dictionaryType_insertApi"
    :update-api="dictionaryType_updateApi"
    :wrapper-col="{span:16}"
  >
    <a-form-model-item label="类型标识" prop="codeItemId" ref="codeItemId" :hasFeedback="true">
      <a-input v-model="dictionaryTypeForm.codeItemId" placeholder="请输入类型标识" />
    </a-form-model-item>
    <a-form-model-item label="类型名称" prop="codeItemName">
      <a-input v-model="dictionaryTypeForm.codeItemName" placeholder="请输入类型名称" :hasFeedback="true" />
    </a-form-model-item>
    <a-form-model-item label="排序" prop="sortNo">
      <a-input v-model.number="dictionaryTypeForm.sortNo" placeholder="请输入排序" :hasFeedback="true" />
    </a-form-model-item>
    <a-form-model-item label="能否更新" prop="isUpdate">
      <a-radio-group v-model="dictionaryTypeForm.isUpdate">
        <a-radio :value="true">可以</a-radio>
        <a-radio :value="false">不能</a-radio>
      </a-radio-group>
    </a-form-model-item>
  </basic-form>
</template>
<script>
import {
  dictionaryType_queryByIdApi,
  dictionaryType_insertApi,
  dictionaryType_updateApi
} from "@/api/cms/dictionaryType";
import { dictionaryTypeRule } from "@/profile/cms/dictionaryType";
export default {
  props: {
    dictionaryTypeId: {
      //数据字典类别id
      type: String
    }
  },
  data() {
    return {
      dictionaryType_queryByIdApi,
      dictionaryType_insertApi,
      dictionaryType_updateApi,
      dictionaryTypeForm: {
        dictionaryTypeId: this.dictionaryTypeId,
        codeItemId: undefined
      },
      dictionaryTypeRule
    };
  },
  watch: {
    "dictionaryTypeForm.codeItemId": function(val) {
      this.$emit("codeItemIdChange", val);
    }
  }
};
</script>